<script>
  let array1 = [2, 4, 9, 2, 43];
  for (let i = 0; i < array1.length; i++) {
    // console.log(array1[i]);
    if (i === 3) {
      break;
    }
  }

  let array2 = [11, 12, 3, 5, 12, 15];
  for (let val of array2) {
    // console.log(val);
    if (val === 3) break;
  }

  const persons = {
    name: "jack",
    age: 28,
    job: "singer",
    sex: "girl",
  };
  for (let key in persons) {
    if (key == "job") break;
    // console.log(persons[key]);
  }

  try {
    let newArr = ["one", "two", "three", "four"];
    newArr.forEach((item) => {
      //   console.log(item);
      if (item == "two") {
        throw new Error("End");
      }
    });
  } catch (error) {
    if (error.message != "End") throw error;
  }

  let mapArr = [12, 44, 265, 897, 22];
  try {
    mapArr.map((item) => {
      //   console.log(item);
      if (item === 265) {
        throw new Error("stop");
      }
    });
  } catch (error) {
    if (error.message !== "stop") throw error;
  }

  mapArr.some((item) => {
    // console.log(item);
    if (item === 265) return true;
  });

  let lists = [
    { name: "aaa", age: 3 },
    { name: "bbb", age: 6 },
    { name: "ccc", age: 7 },
  ];

  let flag = lists.every((item) => {
    console.log(item);
    return item.age > 4;
  });
  console.log(flag);
</script>
